package org.gntc.prayer.database;

import android.provider.BaseColumns;

public final class PrayerDBInfo {
	private static final String PrayerCategory_id = PrayerCategoryTable._ID;

	public static final class PrayerTable implements BaseColumns{
		
		// Prayer table name
		public static final String _TABLENAME = "prayer";
		
		// name of columns
		public static final String TITLE = "title";
		public static final String CONTENT = "content";
		public static final String REGISTERED_DATE = "regist";
		public static final String START_DATE = "start";
		public static final String END_DATE = "end";
		public static final String CATEGORY = "category";
		public static final String FAVORITE = "favorite";
		
		// create command string
//		CREATE TABLE IF NOT EXISTS prayer (
//		_id INTEGER PRIMARY KEY AUTOINCREMENT, 
//		title TEXT NOT NULL, 
//		content TEXT, 
//		regist DATE DEFAULT CURRENT_DATE, 
//		start DATE, 
//		end DATE, 
//		category INTEGER DEFAULT 1,
//		favorite BOOLEAN DEFAULT FALSE,
//		FOREIGN KEY(category) REFERENCES prayer_category (_id) ON DELETE SET DEFAULT
//		);
		public static final String _CREATE = 
				"CREATE TABLE IF NOT EXISTS " + _TABLENAME + " ("
						+ _ID + " INTEGER PRIMARY KEY AUTOINCREMENT, "
						+ TITLE + " TEXT NOT NULL, "
						+ CONTENT + " TEXT, "
						+ REGISTERED_DATE + " DATE DEFAULT CURRENT_DATE, "
						+ START_DATE + " DATE, "
						+ END_DATE + " DATE, "
						+ CATEGORY + " INTEGER DEFAULT 1, "
						+ FAVORITE + " BOOLEAN DEFAULT FALSE, "
						+ "FOREIGN KEY(" + CATEGORY + ") REFERENCES " + PrayerCategory_id + "prayer_category (_id)"
						+ ");";
		
		public static final String _DROP = "DROP TABLE IF EXISTS " + _TABLENAME;
	}
	
	public static final class PrayerCategoryTable implements BaseColumns{
		// PrayerCategory table name
		public static final String _TABLENAME = "prayer_category";

		// name of columns
		public static final String NAME = "name";

		// create command string
//		CREATE TABLE IF NOT EXISTS prayer_category (
//		_id INTEGER PRIMARY KEY AUTOINCREMENT, 
//		name TEXT NOT NULL UNIQUE
//		);
		public static final String _CREATE = 
				"CREATE TABLE IF NOT EXISTS " + _TABLENAME + " ("
						+ _ID + " INTEGER PRIMARY KEY AUTOINCREMENT, "
						+ NAME + " TEXT NOT NULL UNIQUE"
						+ ");";
		
		public static final String _DROP = "DROP TABLE IF EXISTS " + _TABLENAME;
	}
}